﻿using Libs;

namespace WriteForFighting.Game.View.Control
{
    class TextLabel : ControlBase
    {
        private string[] texts = new string[1];
        public string Text
        {
            get
            {
                string t = "";
                foreach (string s in texts)
                {
                    t += s + "\n";
                }

                return t;
            }
            set { texts = value.Split('\n'); }
        }
        public int Color { get; set; }
        public int FontHandle { get; set; }
        public int EdgeColor { get; set; }

        public TextLabel(int par1X, int par2Y, string par3Text, int par4Color, int par5FontHandle, int par6EdgeColor = 0)
            : base(par1X, par2Y)
        {
            Text = par3Text;
            Color = par4Color;
            FontHandle = par5FontHandle;
            EdgeColor = par6EdgeColor;
        }

        public override void Update() { }

        public override void Draw()
        {
            int fontSize = DX.GetFontSizeToHandle(FontHandle);

            for (int i = 0; i < texts.Length; ++i )
            {
                DX.DrawStringToHandle(X, Y + (fontSize * i) + i, texts[i], Color, FontHandle, EdgeColor);
            }
        }
    }
}
